package com.crazy.shell.config.event;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Component;

/**
 * Created by creazier.huang on 16/10/13.
 */
@Component
public class CustomEventPulisher implements ApplicationEventPublisherAware {

    private ApplicationEventPublisher publisher;


    @Override
    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.publisher = applicationEventPublisher;
    }

    public void  publish(){
        CustomEvent event = new CustomEvent(this);
        publisher.publishEvent(event);
    }


}
